<%@page import="controller.Utils"%>
<%@page import="models.Domain"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.text.NumberFormat"%>
<%
String strs = (String) request.getAttribute("strs");
String name = (String) request.getAttribute("name");
Domain domain = (Domain) request.getAttribute("domain");
	
Date date = new Date();
Date dates = new Date();
if(domain.getDate() != null)
{
	dates = domain.getDate();
}
long seconds = (date.getTime() - dates.getTime())/1000;
long day = (int) (seconds / 86400);
long hour = (int) ((seconds - day*86400) / 3600);
long minute = (int) ((seconds - day*86400 - hour*3600) / 60);


NumberFormat nf = NumberFormat.getInstance();
String title = domain.getDomain();
String description = domain.getDomain();
String keyword = domain.getDomain();
if(domain.getTitle()!=null)
{
	title +=" - "+domain.getTitle(); 	
}
if(domain.getDescription()!=null)
{
	description +=" - "+domain.getDescription().getValue(); 	
}
if(domain.getKeywords()!=null)
{
	keyword +=","+domain.getKeywords().getValue(); 	
}
if(description.length()<70&&domain.getDes()!=null)
{
	description+=domain.getDes().getValue();
}
if(description.length()<40)
	description+=",here you can find full information about "+domain.getDomain()+" as whois,ip,backlink";
if(description.length()>250)
	description=description.substring(0,240);
if(keyword.length()>250)
	keyword=keyword.substring(0,240);

String names = domain.getDomain();
String dedate = (dates.getYear()+1900)+"-"+(dates.getMonth()+1)+"-"+dates.getDate();
%>
<%
	request.setCharacterEncoding("utf-8");
%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>
<jsp:include page="./layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keyword %>"/>
	<jsp:param name="name" value="<%=names %>" />
	<jsp:param name="link" value="detail" />
	<jsp:param name="date" value="<%=dedate %>" />
</jsp:include>

		<section id="content">
        	<div id="content_inner">
            	<div class="rotarapes"></div>                
                <div id="leftSideContent">
                	<section>
                		<div class="clearafter siteChecked">
		                	<div class="left"><%@ include file='/adv/adv200x200.jsp'%></div>
		                    <div class="right">
		                    	<h1 class="websiteName"><a href="/sl/<%=domain.getDomain() %>"><%=domain.getDomain() %></a></h1>
		                    	<p><%=(domain.getTitle()!=null)?domain.getTitle():"" %></p>
		                        <p><%=(domain.getDes()!=null)?domain.getDes().getValue():"" %></p><br/>
		                        <div><%@ include file='/adv/adv480x60.jsp'%></div>
		                    </div>
		                    <div class="clearbreak"></div>
		                    <div class="siteUpate content-right">
		                    	Updated<b>
								<%
									if(day > 0)
									{
										out.print(day+" days, ");
									}
									if(hour > 0)
									{
										out.print(hour+" hours, ");
									}
									out.print(minute+" minutes");
								%>	
								</b> Ago
								<%
								if(day>=7 || domain.getDate() == null)
								{
								%>
											<strong class="size">( <a href="javascript:void(0)" rel="nofollow" id="update">Update</a> )</strong>
								<%
								}
								%>
		                    </div>
		                </div>
                	</section>         	
                	<section id="ranking" class="blockContent clearafter">                    	
                        <div class="left">
                    		<h3 class="title">Ranking info</h3>
                            <ul class="infoDetail">
                            	<li class="clearafter">
                                	<div class="infoLeft">Google pagerank : </div>
                                    <div class="infoRight"><%=(domain.getGooglepr()!=null)?domain.getGooglepr():"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Alexa rank : </div>
                                    <div class="infoRight"><%=domain.getAlexa()!=0?nf.format(domain.getAlexa()):"-" %></div>
                                </li>
                            </ul>
                            <h3 class="title">Domain info</h3>
                            <ul class="infoDetail">
                            	<li class="clearafter">
                                	<div class="infoLeft">Domain name : </div>
                                    <div class="infoRight">
                                    	<strong><%=domain.getDomain()%></strong>
                                        <br />
										<strong>Length : </strong> <%=Utils.checkLengthDomain(domain.getDomain()) %> characters
                                    </div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Subdomain : </div>
                                    <div class="infoRight"><strong><%=domain.getDomain()%></strong> <%=Utils.returnSubDomain(domain.getDomain()) %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Favicon : </div>
                                    <div class="infoRight"><img src="https://s2.googleusercontent.com/s2/favicons?domain_url=http://<%=domain.getDomain()%>"/></div>
                                </li>
                            </ul>
                        </div>
                        <div class="right">
                    		<%@ include file='/adv/left.jsp'%>
                        </div>
                    </section>
                    <div class="rotarapes"></div>
                    <section id="siteParameter" class="blockContent clearafter">
                    	<div>
                        	<h3 class="title">Site parameters of <%=domain.getDomain() %></h3>
                            <ul class="infoDetail">
                            	<li class="clearafter">
                                	<div class="infoLeft">Estimate Visitor : </div>
                                    <div class="infoRight"><%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit().replaceAll("[^0-9.]","")))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit().replaceAll("[^0-9.]","")))*120)/0.03)):"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Speed site : </div>
                                    <div class="infoRight"><%=(domain.getSpeed()!=null)?domain.getSpeed()+" Seconds":"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Domain Age : </div>
                                    <div class="infoRight"><%=(domain.getAge()!=null)?domain.getAge():"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Charset : </div>
                                    <div class="infoRight"><%=(domain.getCharset()!=null)?domain.getCharset():"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">WOT : </div>
                                    <div class="infoRight"><%=(domain.getWot()!=null)?domain.getWot():"-" %></div>
                                </li>
                                <li class="clearafter">
                                	<div class="infoLeft">Page speed : </div>
                                    <div class="infoRight" id='page_speed'><a href="javascript:void(0)" onclick="runPagespeed()">Check now</a></div>
                                </li>
                            </ul>
                        </div>                        
                    </section>
                    <div class="rotarapes"></div>
                    <section id="siteInfo" class="blockContent clearafter">
                        <h3 class="title">Site info of <%=domain.getDomain() %></h3>
                        <ul class="infoDetail">
                            <li class="clearafter">
                                <div class="infoLeft">Other domain : </div>
                                <div class="infoRight"><a href="/sd/<%=Utils.returnSubDomainTo(domain.getDomain())%>"><%=Utils.returnSubDomainTo(domain.getDomain())%></a></div>
                            </li>
                            <li class="clearafter">
                                <div class="infoLeft">Keywords : </div>
                                <div class="infoRight">
                                	<%
									int jk = 0;
									if(domain.getKeywords()!=null)
									{
										String[] arrayList = domain.getKeywords().getValue().split(",");
										for(int i=0;i<arrayList.length;i++)
										{
											jk++;
									%>
											<a href="/t/<%=arrayList[i].trim() %>"><%=arrayList[i].trim() %></a> | 
									<%
										}
									}
									%>
									<br>
									<strong>Length : <%=(domain.getKeywords()!=null)?Utils.returnLength(domain.getKeywords().getValue()):"0" %></strong>  characters<br>
									<strong>Number : <%=jk %></strong>  keywords
                                </div>
                            </li>
                            <li class="clearafter">
                                <div class="infoLeft">Popular Keywords : </div>
                                <div class="infoRight">
                                	<%
									if(domain.getPopularKeyword()!=null)
									{
										String[] arrayList = domain.getPopularKeyword().getValue().split(",");
										for(int i=0;i<arrayList.length;i++)
										{
									%>
											<a href="/t/<%=arrayList[i].trim() %>"><%=arrayList[i].trim() %></a> | 
									<%
										}
									}
									%>
                                </div>
                            </li>
                        </ul>
                    </section>
                                      
                    <section class="blockContent clearafter">
                    	<h3 class="title">About site</h3>
                        <div id="tabs">
                            <ul>
                                <li><a href="#tabs-1">Site info</a></li>
                                <%
								if(domain.getWhois()!=null)
								{
								%>
                                <li><a href="#tabs-2">Whois</a></li>
                                <%
								}
                                if(domain.getDsn()!=null)
            					{
                                %>
                                <li><a href="#tabs-3">DNS Record</a></li>
                                <%
            					}
                                if(domain.getNs()!=null)
            					{
                                %>
                                <li><a href="#tabs-4">NSLOOKUP</a></li>
                                <%
            					}
                                %>
                                <%
								if(domain.getIp()!=null&&domain.getWhoisIp()!=null)
								{
								%>
                                <li><a href="#tabs-5">Whois ip <%=domain.getIp() %></a></li>
                                <%
								}
                                %>
                            </ul>
                            <div id="tabs-1">
                                <ul class="infoDetail">
		                        	<li class="clearafter">
		                            	<div class="infoLeft">Programming Language : </div>
		                                <div class="infoRight"><%=(domain.getLanguage()!=null)?domain.getLanguage():"-" %></div>
		                            </li>
		                            <li class="clearafter">
		                            	<div class="infoLeft">Web server : </div>
		                                <div class="infoRight"><%=(domain.getServer()!=null)?domain.getServer():"-" %></div>
		                            </li>                            
		                            <li class="clearafter">
		                            	<div class="infoLeft">Javascript library : </div>
		                                <div class="infoRight"><%=(domain.getJavascript()!=null)?Utils.returnString(domain.getJavascript(),""):"-" %></div>
		                            </li>
		                            <li class="clearafter">
		                            	<div class="infoLeft">IP Address : </div>
		                                <div class="infoRight"><%=(domain.getIp()!=null)?"<a href='/i/"+domain.getIp()+"'>"+domain.getIp()+"</a>":"-" %></div>
		                            </li>
		                            <li class="clearafter">
		                            	<div class="infoLeft">Google Analytic : </div>
		                                <div class="infoRight"><%=(domain.getGoogleAnalytic()!=null)?domain.getGoogleAnalytic():"-" %></div>
		                            </li>
		                            <li class="clearafter">
		                            	<div class="infoLeft">Google Adsense : </div>
		                                <div class="infoRight"><%=(domain.getGoogleAdsense()!=null)?domain.getGoogleAdsense():"-" %></div>
		                            </li>
		                        </ul>
                            </div>
                            <%
							if(domain.getWhois()!=null)
							{
							%>
                            <div id="tabs-2">
                                <%=(domain.getWhois()!=null)?Utils.returnWhois(domain.getWhois().getValue()):"" %>
                                <br/>
                                More detail whois  <a href="/w/<%=domain.getDomain()%>" ><%=domain.getDomain() %></a> 
                            </div>
                            <%
							}
                            if(domain.getDsn()!=null)
        					{
                            %>
                            <div id="tabs-3">
                                <%=(domain.getDsn()!=null)?domain.getDsn().getValue():"" %>
                            </div>
                            <%
        					}
                            if(domain.getNs()!=null)
        					{
                            %>
                            <div id="tabs-4">
                                <%=(domain.getNs()!=null)?domain.getNs().getValue():"" %>
                            </div>
                            <%
        					}
                            %>
                            <%
							if(domain.getIp()!=null&&domain.getWhoisIp()!=null)
							{
							%>
                            <div id="tabs-5">
                                <%=(domain.getWhoisIp()!=null)?Utils.returnWhois(domain.getWhoisIp().getValue()):"" %>
                            </div>
                            <%
							}
                            %>
                        </div>
                    </section>
                    <div class="rotarapes"></div>
                    <section id="siteSeo" class="blockContent clearafter">
                    	<h3 class="title">Site Seo</h3>
                        <ul class="infoDetail">
                        	<li class="clearafter">
                            	<div class="infoLeft">Tag : </div>
                                <div class="infoRight">
                                	<table cellpadding="0" cellspacing="0" width="100%">
                                    	<thead>
                                        	<tr>
                                            	<th>H1</th>
                                                <th>H2</th>
                                                <th>H3</th>
                                                <th>H4</th>
                                                <th>H5</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        	<tr>
                                            	<th><%=(domain.getH1()!=0)?domain.getH1():"0" %></th>
												<th><%=(domain.getH2()!=0)?domain.getH2():"0" %></th>
												<th><%=(domain.getH3()!=0)?domain.getH3():"0" %></th>
												<th><%=(domain.getH4()!=0)?domain.getH4():"0" %></th>
												<th><%=(domain.getH5()!=0)?domain.getH5():"0" %></th>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Image : </div>
                                <div class="infoRight">
                                	We found <b><%=(domain.getImg()!=0)?domain.getImg():"-" %></b> images on this website.
									<%=(domain.getImgAlt()!=0)?"<br/>There are <b>"+domain.getImgAlt()+" </b>images alt attribute":"-" %>
                                </div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Frame : </div>
                                <div class="infoRight"><%=(domain.getFrame()!=0)?domain.getFrame():"No" %></div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Flash : </div>
                                <div class="infoRight"><%=(domain.getFlash()!=0)?domain.getFlash():"No" %></div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Size : </div>
                                <div class="infoRight"><%=(domain.getSize()!=null)?nf.format(Integer.parseInt(domain.getSize()))+" characters":"-" %> </div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Meta Description : </div>
                                <div class="infoRight"><%=domain.getCheckDes()!=0?"Yes":"No" %></div>
                            </li>
                            <li class="clearafter">
                            	<div class="infoLeft">Meta Keyword : </div>
                                <div class="infoRight"><%=domain.getCheckKey()!=0?"Yes":"No" %></div>
                            </li>
                        </ul>
                    </section>
                    <section id="crossLink" class="blockContent clearafter">
                    	<h3 class="title">Cross link</h3>
                        <ul class="infoDetail">
                        	<li class="clearafter">
                            	<div class="infoLeft">Out link : </div>
                                <div class="infoRight">
                                	<%
										String[] arr=null;
										if(domain.getOutLink()!=null&&!domain.getOutLink().getValue().trim().equals(""))
										{
											arr = domain.getOutLink().getValue().split(",");
										}
									%>
									<%
										if(arr!=null)
										{
											for(int j=0;j<arr.length;j++)
											{
											%>
												<% if(!Utils.fomatDomain(arr[j]).trim().equals("")){ %><a href="/d/<%=Utils.fomatDomain(arr[j]) %>" rel="nofollow"><%=Utils.fomatDomain(arr[j]) %></a> | <% } %>
											<%
											}
										}
									%>
                                </div>
                            </li>
						</ul>
                    </section>
                    <section id="domainTraffic" class="blockContent clearafter">
                    	<h3 class="title">Domain Traffic Graph</h3>
                        <div class="clearafter graph">
                        	<div class="left">
                            	<p><strong>Daily Rank</strong></p>
                            	<img src="http://traffic.alexa.com/graph?c=1&u=<%=domain.getDomain() %>&r=6m&y=t&z=3&h=200&w=280&b=FFFFFF" alt="Daily Rank <%=domain.getDomain() %>"/>
                            </div>
                            <div class="right">
                            	<p><strong>Daily PageViews</strong></p>
                            	<img src="http://traffic.alexa.com/graph?c=1&u=example.com&r=6m&y=t&z=3&h=200&w=280&b=FFFFFF" alt="Daily PageViews <%=domain.getDomain() %>"/>
                            </div>
                        </div>
                    </section>
                    <div class="rotarapes"></div>
                    <section id="uniqueVisitors" class="blockContent clearafter">
                    	<h3 class="title">Statistics</h3>
                        <div class="left">
                        	<img src="http://grapher.compete.com/<%=domain.getDomain() %>_uv_310.png" alt="Unique Visitors <%=domain.getDomain() %>"/>
                        </div>
                        <div class="right">
                        	<img src='http://www.majesticseo.com/charts/backlinks-discovery/<%=domain.getDomain() %>?w=290&h=170&IndexDataSource=F' alt="Magestic Backlinks <%=domain.getDomain() %>"/>
                        </div>
                    </section>
                </div>
                <aside id="rightSideContent">
                	<div class="simpleBox">
                    	<a href="http://hatforrent.com/" rel="nofollow" target="_blank"><img src="/images/2.png" alt="hatforrent"/></a>
                    </div>
                    <div class="simpleBox">
                    	<h3 class="title redColor">Other domain</h3>
                        <ul class="domainListing">
                        	<%
								String[] oth = domain.getOtherDomain().split(",");
								for(int i=0;i<oth.length;i++)
								{
							%>
								<li><a href="/d/<%=oth[i]%>"><%=oth[i]%></a></li>
							<%
								}	
							%>
                        </ul>
                    </div>
                    <div class="simpleBox featuredSite">
                    	<h3 class="title redColor">Featured site</h3>
                        <ul class="featuredSiteListing">
                        	<li><a href="http://web20vn.com/" rel="nofollow" target="_blank"><img src="http://www.as7.org/images/domaintips.png" /></a></li>
							<li><a href="http://www.questiondb.com/" rel="nofollow" target="_blank"><img src="http://www.as7.org/images/faq.png" /></a></li>
                            <li><a href="http://prapi.net/" rel="nofollow" target="_blank"><img src="http://www.as7.org/images/prapi.png" /></a></li>
                            <li><a href="http://www.yooarticles.net/" rel="nofollow" target="_blank"><img src="http://www.as7.org/images/yoo.png" /></a></li>
                        </ul>
                    </div>
                </aside>
                <div class="clearbreak"></div>
            </div>
        </section>


		
<div id='opacity'></div>
<img src="/images/ajax-loader.gif" id='image_loadder'/>	
<script type="text/javascript">
	var domain = '<%=domain.getDomain()%>';
	
</script>	
<script src="/custom/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="/js/detail.js"></script>
<link rel="stylesheet" type="text/css" href="/custom/css/ui-lightness/jquery-ui-1.9.2.custom.css" />

<script src="/custom/js/jquery-ui-1.9.2.custom.min.js"></script>

<script type="text/javascript">
	$(document).ready(function () {
		$( "#tabs" ).tabs();
	});
</script>
<%@ include file='/layout/footer.jsp'%>		